//
//  KAExitBottomView.swift
//  kano
//
//  Created by Frank on 2025/5/15.
//

import UIKit

class KAExitBottomView: UIView {
    let onlineServiceButton = UIButton()
    let cancelButton = UIButton()
    let confirmButton = UIButton()
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        setupUI()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    private func setupUI() {
        addSubview(onlineServiceButton)
        addSubview(cancelButton)
        addSubview(confirmButton)
        
        // onlineService Button
        onlineServiceButton.backgroundColor = .white
        onlineServiceButton.setTitle("Need help, contact online customer service", for: .normal)
        onlineServiceButton.setTitleColor(.themeColor, for: .normal)
        onlineServiceButton.titleLabel?.font = UIFont.systemFont(ofSize: kscale(13))
//        onlineServiceButton.titleLabel?.textAlignment = .left
//        onlineServiceButton.contentHorizontalAlignment = .left
//        onlineServiceButton.titleEdgeInsets = UIEdgeInsets(top: 0, left: 10, bottom: 0, right: 0) 
        onlineServiceButton.frame = CGRect(x: kscale(20), y: kscale(5), width: var_screenWidth-kscale(40), height: kscale(30))
        
        
        let width =  (UIScreen.main.bounds.width - kscale(60)) * 0.5
        // Cancel Button
        cancelButton.backgroundColor = .white
        cancelButton.setTitle("Exit", for: .normal)
        cancelButton.setTitleColor(.themeColor, for: .normal)
        cancelButton.titleLabel?.font = UIFont.systemFont(ofSize: kscale(16))
        cancelButton.layer.cornerRadius = kscale(6)
        cancelButton.layer.borderWidth = 1
        cancelButton.layer.borderColor = UIColor.themeColor.cgColor
        cancelButton.frame = CGRect(x: kscale(20), y: kscale(45), width: width, height: kscale(44))
        
        // Confirm Button
        confirmButton.backgroundColor = .themeColor
        confirmButton.setTitle("Continue", for: .normal)
        confirmButton.setTitleColor(.white, for: .normal)
        confirmButton.titleLabel?.font = UIFont.systemFont(ofSize: kscale(16))
        confirmButton.layer.cornerRadius = kscale(6)
        confirmButton.frame = CGRect(x: width + kscale(40), y: kscale(45), width: width, height: kscale(44))
        
    }
    
}
